﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VTFC
{
    // ----------------------------------------------------------------------------
    /// <summary>
    /// Team Foundation Server metadata.
    /// </summary>
    // ----------------------------------------------------------------------------
    [Serializable]
    public class Server
    {
        /// <summary>Url for (WSS 3.0 based) project portal.</summary>
        public string Url { get; set; }
        /// <summary>Local workdirectory path, which contains the documents.</summary>
        public string WorkDircetory { get; set; }        
        /// <summary>UseDefaultCredentials for authentication.</summary>
        public bool UseDefaultCredentials { get; set; }
        /// <summary>Domain name of the account.</summary>
        public string Domain { get; set; }
        /// <summary>UserName name of the account.</summary>
        public string UserName { get; set; }
        /// <summary>Password name of the account.</summary>
        public string Password { get; set; }
        /// <summary><see cref="VTFC.CheckinType"/> enum.</summary>
        public CheckinType DefaultCheckinType { get; set; }
        /// <summary>Show files in the folder out of source control?</summary>
        public bool ShowUnControlledFiles { get; set; }
        
        /// <summary>Name of the project.</summary>
        public string Name
        {
            get
            {
                string[] parts = Url.Split(new char[1] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                return parts[parts.Length - 1];
            }
        }//prop Name

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        // ----------------------------------------------------------------------------
        public Server()
        {
        }//ctor
    }//class Server    
}//namespace VTFC
